<?php

namespace Database\Seeders;

use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     *
     * @return void
     */
    public function run()
    {
//         \App\Models\User::factory(10)->create();
//
//         \App\Models\User::factory()->create([
//             'name' => 'Test User',
//             'email' => 'test@example.com',
//         ]);
        $this->call([
            UsersTableSeeder::class,
            TopicsTableSeeder::class,
            RepliesTableSeeder::class,
            LinksTableSeeder::class
        ]);
        $user = User::find(1);
        // 初始化用户角色，将 1 号用户指派为『站长』
        $user->assignRole('Founder');
        $user->name = 'Jack';
        $user->email = '3136928203@qq.com';
        $user->password = bcrypt('123123');
        $user->save();
        $user = User::find(2);
        $user->assignRole('Maintainer');
        $user->name = 'Rose';
        $user->email = 'Rose@xxxxx.xx';
        $user->password = bcrypt('123123');
        $user->save();
        $user = User::find(3);
        $user->name = 'Tom';
        $user->email = 'Tom@xxxxx.xx';
        $user->password = bcrypt('123123');
        $user->save();
    }
}
